module.exports = (app) => {
  const { STRING, INTEGER, DATE, TEXT, BOOLEAN } = app.Sequelize
  const Upkeep = app.model.define('upkeep', {
    id: {
      type: INTEGER(10).UNSIGNED,
      allowNull: false,
      autoIncrement: true,
      primaryKey: true,
      comment: '主键id'
    },
    title: {
      type: STRING(255),
      allowNull: false,
      comment: '标题'
    },
    desc: {
      type: TEXT,
      allowNull: false,
      comment: '描述'
    },
    poster: {
      type: STRING(255),
      allowNull: false,
      comment: '海报'
    },
    status: {
      type: BOOLEAN,
      allowNull: false,
      defaultValue: 1,
      comment: '状态 0:禁用 1:启用'
    },
    content: {
      type: TEXT,
      allowNull: false,
      comment: '内容'
    },
    tag: {
      type: STRING(255),
      allowNull: false,
      comment: '标签'
    },
    created_at: {
      type: DATE,
      get() {
        return new Date(this.getDataValue('created_at')).getTime()
      }
    },
    updated_at: DATE
  })
  return Upkeep
}
